package com.xt.purchasingsystem.controller.stockManagement;

import com.github.pagehelper.PageHelper;
import com.xt.purchasingsystem.dto.DFileDto;
import com.xt.purchasingsystem.dto.SGatherDto;
import com.xt.purchasingsystem.model.SGather;
import com.xt.purchasingsystem.service.stockManagementService.WarehousingApplicationManageService;
import com.xt.purchasingsystem.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 库存管理-->入库申请管理的所有接口
 *
 * @author: 老姚
 * Date:  2020/5/25 21:18
 */
@RestController
@RequestMapping("/warehousingManagement")
public class WarehousingApplicationManagementController {

    @Autowired
    private WarehousingApplicationManageService warehousingApplicationManageService;

    /**
     * 多条件分页查询可以提交入库申请单的产品档案的接口
     *
     * @param dFileDto
     * @return
     */
    @PostMapping("/getAllWarehousingDfileByDto")
    public Result getAllWarehousingDfileByDto(@RequestBody DFileDto dFileDto) {
        return warehousingApplicationManageService.getAllWarehousingDfileByDto(dFileDto);
    }

    /**
     * 提交入库申请单的接口
     *
     * @param sGatherDto
     * @return
     */
    @PostMapping("/submitWarehouse")
    public Result submitWarehouse(@RequestBody SGatherDto sGatherDto) {
        return warehousingApplicationManageService.submitWarehouse(sGatherDto);
    }

    /**
     * 分页查询所有未审核的入库申请单及其明细的接口
     * @param currNo
     * @param pageSize
     * @return
     */
    @GetMapping("/getAllNoCheckSgatherByPage/{currNo}/{pageSize}")
    public Result getAllNoCheckSgatherByPage(@PathVariable Integer currNo, @PathVariable Integer pageSize) {
        return warehousingApplicationManageService.getAllNoCheckSgatherByPage(currNo, pageSize);
    }

    /**
     * 审核入库申请单的接口
     * @param sGather
     * @return
     */
    @PutMapping("/checkSgather")
    public Result checkSgather(@RequestBody SGather sGather) {
        return warehousingApplicationManageService.checkSgather(sGather);
    }

}
